/**
 * @description 指引 \ 用户引导
 * */

import { driver, type DriveStep } from 'driver.js'
import 'driver.js/dist/driver.css'

export const useDriver = (conf: DriveStep[]) => {
  const _driver = driver({
    allowClose: false,
    // opacity: 0,
    nextBtnText: '下一步',
    prevBtnText: '上一步',
    doneBtnText: '完成',
  })

  onMounted(() => {
    _driver.setSteps(conf)
  })

  onUnmounted(() => {
    _driver.destroy()
  })

  function open() {
    _driver.drive()
  }

  return { open }
}
